package priv.pront.code.robot.roboCom_pri_2021.zhi;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-07-09 17:26
 */
public class 答题卡 {
    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    static int n, m;
    static char[][] g;

    public static void main(String[] args) throws IOException {
        String[] s = bf.readLine().split(" ");
        n = Integer.parseInt(s[0]);
        g = new char[n][n];
        m = Integer.parseInt(s[1]);
        for (int i = 0; i < n; i++) {
            Arrays.fill(g[i], '.');
        }
        for (int i = 0; i < m; i++) {
            String ss = bf.readLine();
            int heng, zong;
            if (ss.contains("/") || ss.contains(";")) {
                int index = ss.indexOf("/") == -1 ? ss.indexOf(";") : ss.indexOf("/");
                heng = Integer.parseInt(ss.substring(0, index));
                zong = Integer.parseInt(ss.substring(index + 1));
            } else {
                if (ss.length() < 4) {
                    ss = "0" + ss;
                }
                heng = Integer.parseInt(ss.substring(0, 2));
                zong = Integer.parseInt(ss.substring(2));
            }
            heng--;
            zong--;
            zong = n - zong - 1;
            g[zong][heng] = '#';
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                System.out.print(g[i][j]);
            }
            System.out.println();
        }

    }
}
